package com.luweijie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luweijie.entity.Mountings;
import com.luweijie.mapper.CalculatorBackgroundMapper;
import com.luweijie.service.CalculatorBackgroundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 优惠券信息及规则表 服务实现类
 * </p>
 *
 * @author luweijie
 * @since 2020-06-03
 */
@Service
public class CalculatorBackgroundServiceImpl extends ServiceImpl<CalculatorBackgroundMapper, Mountings> implements CalculatorBackgroundService {
         @Autowired
         CalculatorBackgroundMapper calculatorBackgroundMapper;



    @Override
    public IPage<Mountings> query(Page page) {
        QueryWrapper<Mountings> queryWrapper = new QueryWrapper<>();
        return calculatorBackgroundMapper.selectPage(page, queryWrapper);
    }

    @Override
    public boolean add(Mountings mountings) {
        return calculatorBackgroundMapper.insert(mountings)>0;
    }

    @Override
    public boolean updata(Mountings mountings) {
        return this.updateById(mountings);

    }

    public Mountings a(int id) {

        Mountings a = calculatorBackgroundMapper.a(id);
        return a;
    }
}
